home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************************************
- 6/96 bob Updated #includes to support changed GX Library names.
-
- ©1990 - 1996 Apple Computer, Inc.
- All rights reserved.
- ****************************************************************************************************/
- #include <Types.h>
- #include <QuickDraw.h>
- #include <Fonts.h>
- #include <Windows.h>
- #include <Menus.h>
- #include <SegLoad.h>
- #include <Memory.h>
- #include <Desk.h>
-
- #include <GXGraphics.h>
- #include "GraphicsLibraries.h"
- #include <GXEnvironment.h>
-
- #include <GXTypes.h>
- #include <GXLayout.h>
- #include "LayoutLibrary.h"
-
- #include "SampleInterface.h"
-
- short MyStrLen(char *x);
- static short MyStrLen(x)
- char *x;
- {
- short c = 0;
- while (*x++) c++;
- return c;
- } /* MyStrLen */
-
- void ImposedWidth(WindowPtr sampleWindow)
- {
- /* Variables */
- char *myString = "As you wish";
- gxPoint myPoint;
- gxRunControls gxRunControls;
- gxShape layout;
- short len, level = 0, runLengths[3];
- gxStyle imposedStyle, regularStyle, styleArray[3];
- gxViewPort aViewPort;
-
- /* Initialization */
-
- myPoint.x = ff(30);
- myPoint.y = ff(50);
-
- aViewPort = GXNewWindowViewPort(sampleWindow);
- SetDefaultViewPort(aViewPort);
-
- len = MyStrLen(myString);
- runLengths[0] = 2;
- runLengths[1] = 1;
- runLengths[2] = len - (runLengths[0] + runLengths[1]);
-
- regularStyle = NewLayoutStyle((char *) "\pHoefler Text", ff(50), 0, nil, nil, 0, nil);
-
- InitializeRunControls(&gxRunControls);
- gxRunControls.flags = gxImposeWidth;
- gxRunControls.imposedWidth = ff(144);
- imposedStyle = NewLayoutStyle((char *) "\pHoefler Text", ff(50), 0, &gxRunControls, nil, 0, nil);
-
- styleArray[0] = styleArray[2] = regularStyle;
- styleArray[1] = imposedStyle;
-
- layout = GXNewLayout(
- 1, &len, (void *) &myString,
- 3, runLengths, styleArray,
- 1, &len, &level,
- nil, &myPoint);
- GXDrawShape(layout);
-
- GXDisposeShape(layout);
- GXDisposeStyle(regularStyle);
- GXDisposeStyle(imposedStyle);
- GXDisposeViewPort(aViewPort);
- } /* main */
-